package client.platformdependant;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public abstract class PlatformDependant {

	protected static final String clientName = "client.jar";
	protected static final String directoryName = "system";
	protected static final String installerName = "insCl.jar";
	
	//installs the client to be run at the system startup
	public abstract void installStartup();
	
	//returns path to application home directory
	public abstract String getHomeDirectory();
	
	public static PlatformDependant getInstance() //!!!!!!!!!!!!!!!!!! not fully implemented
	{
		PlatformDependant pd = WindowsDependant.getWindowsInstance();
		return pd;
	}
	
	protected void copyFile(String from, String to)
	{
		FileInputStream fReader = null;
		FileOutputStream fWriter = null;
		int pos = from.lastIndexOf('/');
		int c;
		String fname = from.substring(pos+1);
		try
		{
			fReader = new FileInputStream(from);
			fWriter = new FileOutputStream(to);
			while ((c = fReader.read())!=-1)
			{
				fWriter.write(c);
			}
			fReader.close();
			fWriter.close();
		}
		catch(Exception e){e.printStackTrace(); return;}

	}
}
